Sync 2 Inkeep OSS Changes#764
Merged
Merged
Conversation
* fix(desktop): harvest login-shell SSH_AUTH_SOCK for git sync Finder-launched Electron inherits launchd's SSH_AUTH_SOCK, which points at Apple's default ssh-agent. Users whose keys live in an external SSH agent (1Password, Proton Pass) export the real socket path in their shell rc, so terminal git works while in-app sync fails with Permission denied (publickey). The forwarding in buildGitEnv was already correct; the value it forwarded was wrong from birth. Spawn one interactive login shell at startup (same pattern and spawn discipline as path-install's PATH discovery, sentinel-delimited so rc noise cannot corrupt the value), read SSH_AUTH_SOCK, and patch process.env before the git preflight and both server spawn paths. A failed, timed-out, or empty harvest leaves the inherited socket untouched. Verified against a live repro: stock ssh-agent on a custom socket exported only via .zshrc, key registered with GitHub, packaged Finder-launched build. Sync fails before the change, succeeds after, and fails again when the rc export is removed. Fixes #669 * chore(scripts): brace OK_DIR expansion in setup-open-knowledge echo Under macOS bash 3.2 with a non-UTF-8 locale, the bare $OK_DIR followed immediately by a multibyte ellipsis parses the ellipsis into the variable name, and set -u aborts the script with 'OK_DIR: unbound variable' before the install runs. Bracing the expansion makes the script locale-proof. * fix(desktop): carry stderr and from/to values in authsock log events Review follow-up on the SSH_AUTH_SOCK harvest: the non-zero-exit failure event now includes the shell's stderr (truncated to 300 chars, since a broken rc file can produce unbounded output), and the success event records the previous and new socket values so a correct upgrade is distinguishable from a stale-path regression in field logs. * fix(desktop): make gitSpawnEnv read live env so the harvest reaches all git spawns Review follow-up: worktree-service and worktree-recents froze gitSpawnEnv() into module-level constants at import time, and gitSpawnEnv itself cached the whole env object on first call. Either way the share-fetch and worktree git spawns kept the pre-harvest launchd SSH_AUTH_SOCK, so the external-agent fix never reached that transport. gitSpawnEnv now caches only the augmented PATH (the expensive stat walk) and rebuilds the env from live process.env per call. The two module-level constants become per-call lookups, FETCH_GIT_ENV becomes fetchGitEnv(), and a new git-spawn-env test pins the live-read contract so a future snapshot regression fails fast. The index.ts wiring comment now states the actual guarantee instead of overclaiming lazy-cache coverage. Also carries the marker-missing harvest failure's bounded stdout, the one diagnostic explaining why markers were absent. GitOrigin-RevId: feab7f47b1b96fb359c69386d8841f25e1eba9b5
…(#2834) * fix(server): keep sync alive for SSH origins with no GitHub token The push-permission probe treated a missing gh/OK token as proof the push would fail and paused sync with a sign-in prompt. That inference only holds for HTTPS origins, where git authenticates with a token. SSH and git protocol origins authenticate with SSH keys the probe cannot see, so self-hosted forge users (Gitea, Forgejo) and github.com-over-SSH users with no gh CLI had sync silently disabled despite pushing fine. Key the anonymous short-circuit on the origin transport instead of the host: HTTPS keeps the signed-out denial and its sign-in affordance (including GHES), while ssh, scp-style, and git origins now abstain with a new unknown ssh-unverified result. Unknown is already the lenient posture end to end, so sync proceeds and a genuinely unauthorized push surfaces through the existing auth-error path with an accurate SSH message. The parser now reports which URL form matched (transport), and the wire schema carries the new code. No UI changes needed. * review: derive wire unions from PushPermission, pin ssh-unverified UI predicate Derive the deniedReason and unknownError payload types in sync-engine's PushPermissionStatus structurally from the source-of-truth PushPermission union, so a code added in github-permissions.ts can no longer drift from the wire shape unnoticed. The Zod enum in core still needs its manual twin update; the schema round-trip test covers that half at runtime. Also pin shouldOfferSignInAgain to false for unknown/ssh-unverified so a future broadening of the predicate cannot quietly resurrect the misleading sign-in affordance for SSH-origin users. * style: apply biome formatting to sign-in predicate test GitOrigin-RevId: 1b25773ba684dd932c1dba52e3734ed78727e548
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Copybara-translated 2 Inkeep OSS changes. Rebase-merge this PR so the prepared commits land directly on public main.
Commits: